<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>2 bfc</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    .box {
      background: #ccc;
      border: solid 2px #000;
      /* 方法三 */
      /* font-size: 0; */
    }

    img {
      /* 方法一 */
      display: block;
      /* 方法二 */
      /* vertical-align: middle; */
    }
  </style>
</head>

<body>
  <div class="box">
    <img width=100 src="https://fp1.fghrsh.net/2021/01/11/d6a7d63acd7d9657225e01c91d962795.jpg" width=500>
  </div>
</body>

</html>